﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using NetBay.Core.BusinessEntities;

namespace Rio.Manager.Business.Repository.Translator
{
    public class NumerizationOperatorByDateTranslator
    {
        /// <summary>
        /// Get numerization informations by operator by date
        /// </summary>
        /// <returns></returns>
        public static List<NumerizationOperatorByDate> GetNumerizationReportByOperatorByDate(IDataReader P_oDbDataReader)
        {
            var OperatorsByDate = new List<NumerizationOperatorByDate>();
            try
            {
                using (P_oDbDataReader)
                {
                    while (P_oDbDataReader.Read())
                    {
                        NumerizationOperatorByDate numerizationOperatorByDate = OperatorsByDate.Where(item => item.FullName == P_oDbDataReader["USER_NAME"].ToString()).FirstOrDefault();

                        if (numerizationOperatorByDate == null)
                        {
                            OperatorsByDate.Add(new NumerizationOperatorByDate()
                            {
                                FullName = P_oDbDataReader["USER_NAME"].ToString()
                            });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                NetBay.Core.Log.LogManager.Instance().LogError("EXCEPTION -> " + Environment.NewLine + ex);
            }
            return OperatorsByDate;
        }
    }
}
